// pages/order/paySuccess/paySuccess.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		order_id: 0,
		orderType: '',
		info: null
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function(options) {
		this.data.order_id = options.order_id;
		const orderType = options.orderType || '';
		this.setData({
			orderType: orderType
		});

		if ('course' === orderType) {
			this.loadInfo();
		}
	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {
		return {
			path: '/pages/index/index'
		};
	},

	// 加载额外信息
	loadInfo: function() {
		wx.http.get('api/index/information', {
			order_id: this.data.order_id
		}).then(res => {
			this.setData({
				info: res.data.data
			});
		})
	},

	// 观看视频
	lookVideoTap: function(e) {
		wx.emitter.emit('course.update', 0);
		wx.navigateBack();
	}
});
